﻿namespace WMS6.SQLServerDAL
{
    using System;
    using System.Collections.Generic;
    using System.Data;
    using System.Data.Common;
    using System.Data.SqlClient;
    using WMS6.Common;
    using WMS6.DataEntity;
    using WMS6.DBUtility;
    using WMS6.IDAL;
    using WMS6.QueryEntity;

    public class SkuDA : ISkuDA
    {
        private string ABC = "@ABC";
        private string ALLOCATE_RULE_ID = "@ALLOCATE_RULE_ID";
        private string B_UDF1 = "@B_UDF1";
        private string B_UDF10 = "@B_UDF10";
        private string B_UDF2 = "@B_UDF2";
        private string B_UDF3 = "@B_UDF3";
        private string B_UDF4 = "@B_UDF4";
        private string B_UDF5 = "@B_UDF5";
        private string B_UDF6 = "@B_UDF6";
        private string B_UDF7 = "@B_UDF7";
        private string B_UDF8 = "@B_UDF8";
        private string B_UDF9 = "@B_UDF9";
        private string CALCULATE_PUTAWAY_LOCATION = "@CALCULATE_PUTAWAY_LOCATION";
        private string CARRY_COST = "@CARRY_COST";
        private string CARTON_GROUP = "@CARTON_GROUP";
        private string CC_DISCREPAN_CYRULE = "@CC_DISCREPAN_CYRULE";
        private string COST_PRICE = "@COST_PRICE";
        private string COUNTRY_OF_ORIGIN = "@COUNTRY_OF_ORIGIN";
        private string CREATED_BY = "@CREATED_BY";
        private string CUBE = "@CUBE";
        private string CUSTOM_SKU_NO = "@CUSTOM_SKU_NO";
        private string CYCLE_COUNT_FREQUENCY = "@CYCLE_COUNT_FREQUENCY";
        private string DAYS_TO_EXPIRE = "@DAYS_TO_EXPIRE";
        private string DEFAULT_IN_UOM = "@DEFAULT_IN_UOM";
        private string DEFAULT_OUT_UOM = "@DEFAULT_OUT_UOM";
        private string DESCR = "@DESCR";
        private string DESCR2 = "@DESCR2";
        private string FREIGHT_CLASS = "@FREIGHT_CLASS";
        private string GROSS_WGT = "@GROSS_WGT";
        private string HAZMAT_CODE = "@HAZMAT_CODE";
        private string HEIGHT = "@HEIGHT";
        private string IS_ACTIVE = "@IS_ACTIVE";
        private string IS_SALE_PROMPTION = "@IS_SALE_PROMPTION";
        private string ITEM_NO_ID = "@ITEM_NO_ID";
        private string LAST_CYCLE_COUNT = "@LAST_CYCLE_COUNT";
        private string LENGTH = "@LENGTH";
        private string LOT_TEMPLATE_ID = "@LOT_TEMPLATE_ID";
        private string MAX_QTY = "@MAX_QTY";
        private string MIN_QTY = "@MIN_QTY";
        private string NET_PRICE = "@NET_PRICE";
        private string NET_WGT = "@NET_WGT";
        private string OWNER_ID = "@OWNER_ID";
        private string PACK_ID = "@PACK_ID";
        private string PREALLOCATE_RULE_ID = "@PREALLOCATE_RULE_ID";
        private string PUTAWAY_LOC = "@PUTAWAY_LOC";
        private string PUTAWAY_RULE_ID = "@PUTAWAY_RULE_ID";
        private string QC_LOC = "@QC_LOC";
        private string QC_LOC_OUT = "@QC_LOC_OUT";
        private string RECEIPT_INSPECTION_LOC = "@RECEIPT_INSPECTION_LOC";
        private string RECEIPT_VALIDATION_ID = "@RECEIPT_VALIDATION_ID";
        private string RECEIPT_VALIDATION_TEMPLATE = "@RECEIPT_VALIDATION_TEMPLATE";
        private string REMARK1 = "@REMARK1";
        private string REMARK2 = "@REMARK2";
        private string REORDER_POINT = "@REORDER_POINT";
        private string REORDER_QTY = "@REORDER_QTY";
        private string RETURNS_LOC = "@RETURNS_LOC";
        private string RF_DEFAULT_PACK = "@RF_DEFAULT_PACK";
        private string ROTATION_RULE_ID = "@ROTATION_RULE_ID";
        private string SALE_PRICE = "@SALE_PRICE";
        private string SHELF_LIFE = "@SHELF_LIFE";
        private string SHELF_LIFE_CODE_TYPE = "@SHELF_LIFE_CODE_TYPE";
        private string SHELF_LIFE_INDICATOR = "@SHELF_LIFE_INDICATOR";
        private string SHELF_LIFE_ON_RECEIVING = "@SHELF_LIFE_ON_RECEIVING";
        private string SKU_CLASS_ID = "@SKU_CLASS_ID";
        private string SKU_COLOR = "@SKU_COLOR";
        private string SKU_GROUP = "@SKU_GROUP";
        private string SKU_GROUP2 = "@SKU_GROUP2";
        private string SKU_ID = "@SKU_ID";
        private string SKU_SIZE = "@SKU_SIZE";
        private string SKU_STYLE = "@SKU_STYLE";
        private string SQL_CHECK_SKU_ID_UNIQUE = " SELECT COUNT(1) FROM @_@SKU WHERE OWNER_ID = @OWNER_ID AND SKU_ID = @SKU_ID AND IS_ACTIVE='Y' ";
        private string SQL_DELETE_SKU = " DELETE FROM @_@SKU WHERE OWNER_ID = @OWNER_ID AND SKU_ID = @SKU_ID ";
        private string SQL_INSERT_SKU = " INSERT INTO @_@SKU ( WH_ID, OWNER_ID, SKU_ID, DESCR, DESCR2, PACK_ID, CARTON_GROUP, LOT_TEMPLATE_ID, TARIFF_ID, SKU_CLASS_ID, HAZMAT_CODE, CUSTOM_SKU_NO, COUNTRY_OF_ORIGIN, SHELF_LIFE_INDICATOR, SHELF_LIFE_CODE_TYPE, SHELF_LIFE_ON_RECEIVING, SHELF_LIFE, DAYS_TO_EXPIRE, LENGTH, WIDTH, HEIGHT, CUBE, GROSS_WGT, NET_WGT, TARE_WGT, SKU_SIZE, SKU_COLOR, SKU_STYLE, COST_PRICE, SALE_PRICE, NET_PRICE, IS_SALE_PROMPTION, RECEIPT_VALIDATION_TEMPLATE, DEFAULT_IN_UOM, DEFAULT_OUT_UOM, RF_DEFAULT_PACK, PUTAWAY_RULE_ID, PREALLOCATE_RULE_ID, ALLOCATE_RULE_ID, ROTATION_RULE_ID, CALCULATE_PUTAWAY_LOCATION, RECEIPT_VALIDATION_ID, ZONE_ID, PUTAWAY_LOC, RECEIPT_INSPECTION_LOC, QC_LOC_OUT, RETURNS_LOC, QC_LOC, MAX_QTY, MIN_QTY, REORDER_POINT, REORDER_QTY, STD_ORDER_COST, CARRY_COST, ABC, CYCLE_COUNT_FREQUENCY, LAST_CYCLE_COUNT, CC_DISCREPAN_CYRULE, SKU_GROUP, SKU_GROUP2, TRANSPORT_MODE, FREIGHT_CLASS, UDF1, UDF2, UDF3, UDF4, UDF5, UDF6, UDF7, UDF8, UDF9, UDF10, B_UDF1, B_UDF2, B_UDF3, B_UDF4, B_UDF5, B_UDF6, B_UDF7, B_UDF8, B_UDF9, B_UDF10, REMARK1, REMARK2, IS_ACTIVE, CREATED_BY, CREATED_DATE, UPDATED_BY, UPDATED_DATE,ITEM_NO_ID) VALUES ( @WH_ID, @OWNER_ID, @SKU_ID, @DESCR, @DESCR2, @PACK_ID, @CARTON_GROUP, @LOT_TEMPLATE_ID, @TARIFF_ID, @SKU_CLASS_ID, @HAZMAT_CODE, @CUSTOM_SKU_NO, @COUNTRY_OF_ORIGIN, @SHELF_LIFE_INDICATOR, @SHELF_LIFE_CODE_TYPE, @SHELF_LIFE_ON_RECEIVING, @SHELF_LIFE, @DAYS_TO_EXPIRE, @LENGTH, @WIDTH, @HEIGHT, @CUBE, @GROSS_WGT, @NET_WGT, @TARE_WGT, @SKU_SIZE, @SKU_COLOR, @SKU_STYLE, @COST_PRICE, @SALE_PRICE, @NET_PRICE, @IS_SALE_PROMPTION, @RECEIPT_VALIDATION_TEMPLATE, @DEFAULT_IN_UOM, @DEFAULT_OUT_UOM, @RF_DEFAULT_PACK, @PUTAWAY_RULE_ID, @PREALLOCATE_RULE_ID, @ALLOCATE_RULE_ID, @ROTATION_RULE_ID, @CALCULATE_PUTAWAY_LOCATION, @RECEIPT_VALIDATION_ID, @ZONE_ID, @PUTAWAY_LOC, @RECEIPT_INSPECTION_LOC, @QC_LOC_OUT, @RETURNS_LOC, @QC_LOC, @MAX_QTY, @MIN_QTY, @REORDER_POINT, @REORDER_QTY, @STD_ORDER_COST, @CARRY_COST, @ABC, @CYCLE_COUNT_FREQUENCY, @LAST_CYCLE_COUNT, @CC_DISCREPAN_CYRULE, @SKU_GROUP, @SKU_GROUP2, @TRANSPORT_MODE, @FREIGHT_CLASS, @UDF1, @UDF2, @UDF3, @UDF4, @UDF5, @UDF6, @UDF7, @UDF8, @UDF9, @UDF10, @B_UDF1, @B_UDF2, @B_UDF3, @B_UDF4, @B_UDF5, @B_UDF6, @B_UDF7, @B_UDF8, @B_UDF9, @B_UDF10, @REMARK1, @REMARK2, @IS_ACTIVE, @CREATED_BY, GETDATE(), @UPDATED_BY, GETDATE(),@ITEM_NO_ID )  ";
        private string SQL_SELECT_ALL_SKU = " SELECT  SKU.ROWID AS ROWID, SKU.WH_ID AS WH_ID, SKU.OWNER_ID AS OWNER_ID, SKU.SKU_ID AS SKU_ID, SKU.DESCR AS DESCR, SKU.DESCR2 AS DESCR2, SKU.PACK_ID AS PACK_ID, SKU.CARTON_GROUP AS CARTON_GROUP, SKU.LOT_TEMPLATE_ID AS LOT_TEMPLATE_ID, SKU.TARIFF_ID AS TARIFF_ID, SKU.SKU_CLASS_ID AS SKU_CLASS_ID, SKU.HAZMAT_CODE AS HAZMAT_CODE, SKU.CUSTOM_SKU_NO AS CUSTOM_SKU_NO, SKU.COUNTRY_OF_ORIGIN AS COUNTRY_OF_ORIGIN, SKU.SHELF_LIFE_INDICATOR AS SHELF_LIFE_INDICATOR, SKU.SHELF_LIFE_CODE_TYPE AS SHELF_LIFE_CODE_TYPE, SKU.SHELF_LIFE_ON_RECEIVING AS SHELF_LIFE_ON_RECEIVING, SKU.SHELF_LIFE AS SHELF_LIFE, SKU.DAYS_TO_EXPIRE AS DAYS_TO_EXPIRE, SKU.LENGTH AS LENGTH, SKU.WIDTH AS WIDTH, SKU.HEIGHT AS HEIGHT,SKU.ITEM_NO_ID AS ITEM_NO_ID, SKU.CUBE AS CUBE, SKU.GROSS_WGT AS GROSS_WGT, SKU.NET_WGT AS NET_WGT, SKU.TARE_WGT AS TARE_WGT, SKU.SKU_SIZE AS SKU_SIZE, SKU.SKU_COLOR AS SKU_COLOR, SKU.SKU_STYLE AS SKU_STYLE, SKU.COST_PRICE AS COST_PRICE, SKU.SALE_PRICE AS SALE_PRICE, SKU.NET_PRICE AS NET_PRICE, SKU.IS_SALE_PROMPTION AS IS_SALE_PROMPTION, SKU.RECEIPT_VALIDATION_TEMPLATE AS RECEIPT_VALIDATION_TEMPLATE, SKU.DEFAULT_IN_UOM AS DEFAULT_IN_UOM, SKU.DEFAULT_OUT_UOM AS DEFAULT_OUT_UOM, SKU.RF_DEFAULT_PACK AS RF_DEFAULT_PACK, SKU.PUTAWAY_RULE_ID AS PUTAWAY_RULE_ID, SKU.PREALLOCATE_RULE_ID AS PREALLOCATE_RULE_ID, SKU.ALLOCATE_RULE_ID AS ALLOCATE_RULE_ID, SKU.ROTATION_RULE_ID AS ROTATION_RULE_ID, SKU.CALCULATE_PUTAWAY_LOCATION AS CALCULATE_PUTAWAY_LOCATION, SKU.RECEIPT_VALIDATION_ID AS RECEIPT_VALIDATION_ID, SKU.ZONE_ID AS ZONE_ID, SKU.PUTAWAY_LOC AS PUTAWAY_LOC, SKU.RECEIPT_INSPECTION_LOC AS RECEIPT_INSPECTION_LOC, SKU.QC_LOC_OUT AS QC_LOC_OUT, SKU.RETURNS_LOC AS RETURNS_LOC, SKU.QC_LOC AS QC_LOC, SKU.MAX_QTY AS MAX_QTY, SKU.MIN_QTY AS MIN_QTY, SKU.REORDER_POINT AS REORDER_POINT, SKU.REORDER_QTY AS REORDER_QTY, SKU.STD_ORDER_COST AS STD_ORDER_COST, SKU.CARRY_COST AS CARRY_COST, SKU.ABC AS ABC, SKU.CYCLE_COUNT_FREQUENCY AS CYCLE_COUNT_FREQUENCY, SKU.LAST_CYCLE_COUNT AS LAST_CYCLE_COUNT, SKU.CC_DISCREPAN_CYRULE AS CC_DISCREPAN_CYRULE, SKU.SKU_GROUP AS SKU_GROUP, SKU.SKU_GROUP2 AS SKU_GROUP2, SKU.TRANSPORT_MODE AS TRANSPORT_MODE, SKU.FREIGHT_CLASS AS FREIGHT_CLASS, SKU.IS_ASSEMBLED AS IS_ASSEMBLED, SKU.UDF1 AS UDF1, SKU.UDF2 AS UDF2, SKU.UDF3 AS UDF3, SKU.UDF4 AS UDF4, SKU.UDF5 AS UDF5, SKU.UDF6 AS UDF6, SKU.UDF7 AS UDF7, SKU.UDF8 AS UDF8, SKU.UDF9 AS UDF9, SKU.UDF10 AS UDF10, SKU.B_UDF1 AS B_UDF1, SKU.B_UDF2 AS B_UDF2, SKU.B_UDF3 AS B_UDF3, SKU.B_UDF4 AS B_UDF4, SKU.B_UDF5 AS B_UDF5, SKU.B_UDF6 AS B_UDF6, SKU.B_UDF7 AS B_UDF7, SKU.B_UDF8 AS B_UDF8, SKU.B_UDF9 AS B_UDF9, SKU.B_UDF10 AS B_UDF10, SKU.REMARK1 AS REMARK1, SKU.REMARK2 AS REMARK2, SKU.IS_ACTIVE AS IS_ACTIVE, SKU.TS AS TS, SKU.CREATED_BY AS CREATED_BY, SKU.CREATED_DATE AS CREATED_DATE, SKU.UPDATED_BY AS UPDATED_BY, SKU.UPDATED_DATE AS UPDATED_DATE  FROM @_@SKU SKU INNER JOIN SYSADM.USER_OWNER UO ON SKU.OWNER_ID = UO.OWNER_ID AND UO.[USER_ID] = @USER_ID ";
        private string SQL_UPDATE_SKU = " UPDATE @_@SKU SET WH_ID = @WH_ID, DESCR = @DESCR, DESCR2 = @DESCR2, PACK_ID = @PACK_ID, CARTON_GROUP = @CARTON_GROUP, LOT_TEMPLATE_ID = @LOT_TEMPLATE_ID, TARIFF_ID = @TARIFF_ID, SKU_CLASS_ID = @SKU_CLASS_ID, HAZMAT_CODE = @HAZMAT_CODE, CUSTOM_SKU_NO = @CUSTOM_SKU_NO, COUNTRY_OF_ORIGIN = @COUNTRY_OF_ORIGIN, SHELF_LIFE_INDICATOR = @SHELF_LIFE_INDICATOR, SHELF_LIFE_CODE_TYPE = @SHELF_LIFE_CODE_TYPE, SHELF_LIFE_ON_RECEIVING = @SHELF_LIFE_ON_RECEIVING, SHELF_LIFE = @SHELF_LIFE, DAYS_TO_EXPIRE = @DAYS_TO_EXPIRE, LENGTH = @LENGTH, WIDTH = @WIDTH, HEIGHT = @HEIGHT, CUBE = @CUBE, GROSS_WGT = @GROSS_WGT, NET_WGT = @NET_WGT, TARE_WGT = @TARE_WGT, SKU_SIZE = @SKU_SIZE, SKU_COLOR = @SKU_COLOR, SKU_STYLE = @SKU_STYLE, COST_PRICE = @COST_PRICE, SALE_PRICE = @SALE_PRICE, NET_PRICE = @NET_PRICE, IS_SALE_PROMPTION = @IS_SALE_PROMPTION, RECEIPT_VALIDATION_TEMPLATE = @RECEIPT_VALIDATION_TEMPLATE, DEFAULT_IN_UOM = @DEFAULT_IN_UOM, DEFAULT_OUT_UOM = @DEFAULT_OUT_UOM, RF_DEFAULT_PACK = @RF_DEFAULT_PACK, PUTAWAY_RULE_ID = @PUTAWAY_RULE_ID,ITEM_NO_ID=@ITEM_NO_ID, PREALLOCATE_RULE_ID = @PREALLOCATE_RULE_ID, ALLOCATE_RULE_ID = @ALLOCATE_RULE_ID, ROTATION_RULE_ID = @ROTATION_RULE_ID, CALCULATE_PUTAWAY_LOCATION = @CALCULATE_PUTAWAY_LOCATION, RECEIPT_VALIDATION_ID = @RECEIPT_VALIDATION_ID, ZONE_ID = @ZONE_ID, PUTAWAY_LOC = @PUTAWAY_LOC, RECEIPT_INSPECTION_LOC = @RECEIPT_INSPECTION_LOC, QC_LOC_OUT = @QC_LOC_OUT, RETURNS_LOC = @RETURNS_LOC, QC_LOC = @QC_LOC, MAX_QTY = @MAX_QTY, MIN_QTY = @MIN_QTY, REORDER_POINT = @REORDER_POINT, REORDER_QTY = @REORDER_QTY, STD_ORDER_COST = @STD_ORDER_COST, CARRY_COST = @CARRY_COST, ABC = @ABC, CYCLE_COUNT_FREQUENCY = @CYCLE_COUNT_FREQUENCY, LAST_CYCLE_COUNT = @LAST_CYCLE_COUNT, CC_DISCREPAN_CYRULE = @CC_DISCREPAN_CYRULE, SKU_GROUP = @SKU_GROUP, SKU_GROUP2 = @SKU_GROUP2, TRANSPORT_MODE = @TRANSPORT_MODE, FREIGHT_CLASS = @FREIGHT_CLASS, UDF1 = @UDF1, UDF2 = @UDF2, UDF3 = @UDF3, UDF4 = @UDF4, UDF5 = @UDF5, UDF6 = @UDF6, UDF7 = @UDF7, UDF8 = @UDF8, UDF9 = @UDF9, UDF10 = @UDF10, B_UDF1 = @B_UDF1, B_UDF2 = @B_UDF2, B_UDF3 = @B_UDF3, B_UDF4 = @B_UDF4, B_UDF5 = @B_UDF5, B_UDF6 = @B_UDF6, B_UDF7 = @B_UDF7, B_UDF8 = @B_UDF8, B_UDF9 = @B_UDF9, B_UDF10 = @B_UDF10, REMARK1 = @REMARK1, REMARK2 = @REMARK2, IS_ACTIVE = @IS_ACTIVE, UPDATED_BY = @UPDATED_BY, UPDATED_DATE = GETDATE() WHERE OWNER_ID = @OWNER_ID AND SKU_ID = @SKU_ID  ";
        private string SQL_UPDATE_SKU_ISACTIVE = " UPDATE @_@SKU SET IS_ACTIVE = @IS_ACTIVE, UPDATED_BY = @UPDATED_BY, UPDATED_DATE = GETDATE() WHERE OWNER_ID = @OWNER_ID AND SKU_ID = @SKU_ID ";
        private string SQL_UPDATE_SKU_WEIGHT = " UPDATE @_@SKU SET  NET_WGT = @NET_WGT, UPDATED_BY = @UPDATED_BY, UPDATED_DATE = GETDATE() WHERE OWNER_ID = @OWNER_ID AND SKU_ID = @SKU_ID  ";
        private string SQL_UPDATE_SKU_WEIGHT_SAME_STYLE = " UPDATE @_@SKU SET  NET_WGT = @NET_WGT, UPDATED_BY = @UPDATED_BY, UPDATED_DATE = GETDATE() WHERE OWNER_ID = @OWNER_ID AND SKU_STYLE = @SKU_STYLE  ";
        private string STD_ORDER_COST = "@STD_ORDER_COST";
        private string TARE_WGT = "@TARE_WGT";
        private string TARIFF_ID = "@TARIFF_ID";
        private string TRANSPORT_MODE = "@TRANSPORT_MODE";
        private string TS = "@TS";
        private string UDF1 = "@UDF1";
        private string UDF10 = "@UDF10";
        private string UDF2 = "@UDF2";
        private string UDF3 = "@UDF3";
        private string UDF4 = "@UDF4";
        private string UDF5 = "@UDF5";
        private string UDF6 = "@UDF6";
        private string UDF7 = "@UDF7";
        private string UDF8 = "@UDF8";
        private string UDF9 = "@UDF9";
        private string UPDATED_BY = "@UPDATED_BY";
        private string WH_ID = "@WH_ID";
        private string WIDTH = "@WIDTH";
        private string ZONE_ID = "@ZONE_ID";

        public DataSet CheckSkuIDByItemNoID(string itemNoID, string whLoginID)
        {
            string sql = "SELECT distinct SKU_ID FROM @_@SKU WHERE ITEM_NO_ID = @ITEM_NO_ID";
            SqlParameter[] paras = new SqlParameter[] { new SqlParameter("@ITEM_NO_ID", itemNoID) };
            return DBHelper.ExecuteDataSet(CommandType.Text, sql.Replace("@_@", whLoginID), paras);
        }

        public DataSet CheckSkuIDByItemNoID(DataBase dataBase, DbTransaction tran, string itemNoID, string whLoginID)
        {
            string sql = "SELECT distinct SKU_ID FROM @_@SKU WHERE ITEM_NO_ID = @ITEM_NO_ID";
            SqlParameter[] paras = new SqlParameter[] { new SqlParameter("@ITEM_NO_ID", itemNoID) };
            return DBHelper.ExecuteDataSet(CommandType.Text, sql.Replace("@_@", whLoginID), paras);
        }

        public bool CheckSkuIDUnique(string ownerID, string skuID, string whLoginID)
        {
            SqlParameter[] paras = new SqlParameter[] { new SqlParameter("@OWNER_ID", ownerID), new SqlParameter("@SKU_ID", skuID) };
            return (DBHelper.ExecuteScalar(CommandType.Text, this.SQL_CHECK_SKU_ID_UNIQUE.Replace("@_@", whLoginID), paras).ToString() == "1");
        }

        public bool CheckSkuIDUnique(DataBase dataBase, DbTransaction tran, string ownerID, string skuID, string whLoginID)
        {
            SqlParameter[] paras = new SqlParameter[] { new SqlParameter("@OWNER_ID", ownerID), new SqlParameter("@SKU_ID", skuID) };
            return (dataBase.ExecuteScalar(tran, CommandType.Text, this.SQL_CHECK_SKU_ID_UNIQUE.Replace("@_@", whLoginID), paras).ToString() == "1");
        }

        public int DeleteSku(List<string> ownerID, List<string> whLoginID)
        {
            return 0;
        }

        public int DeleteSku(List<string> ownerID, List<string> skuID, List<string> whLoginID)
        {
            int result = 0;
            DataBase dataBase = new DataBase();
            DbConnection conn = dataBase.connection;
            conn.Open();
            DbTransaction tran = conn.BeginTransaction();
            try
            {
                for (int i = 0; i < whLoginID.Count; i++)
                {
                    for (int j = 0; j < skuID.Count; j++)
                    {
                        SqlParameter[] paras = new SqlParameter[] { new SqlParameter("@OWNER_ID", ownerID[j]), new SqlParameter("@SKU_ID", skuID[j]) };
                        result += dataBase.ExecuteNonQuery(tran, CommandType.Text, this.SQL_DELETE_SKU.Replace("@_@", whLoginID[i]), paras);
                    }
                }
                tran.Commit();
            }
            catch (SqlException sqlEx)
            {
                tran.Rollback();
                CommonErrorHandler.ErrorHandler(sqlEx, LogType.Error);
            }
            finally
            {
                conn.Close();
            }
            return result;
        }

        public int DeleteSku(DataBase dataBase, DbTransaction tran, List<string> ownerID, List<string> whLoginID)
        {
            return 0;
        }

        public int DeleteSku(DataBase dataBase, DbTransaction tran, List<string> ownerID, List<string> skuID, List<string> whLoginID)
        {
            int result = 0;
            try
            {
                for (int i = 0; i < whLoginID.Count; i++)
                {
                    for (int j = 0; j < skuID.Count; j++)
                    {
                        SqlParameter[] paras = new SqlParameter[] { new SqlParameter("@OWNER_ID", ownerID[j]), new SqlParameter("@SKU_ID", skuID[j]) };
                        result += dataBase.ExecuteNonQuery(tran, CommandType.Text, this.SQL_DELETE_SKU.Replace("@_@", whLoginID[i]), paras);
                    }
                }
            }
            catch (SqlException sqlEx)
            {
                CommonErrorHandler.ErrorHandler(sqlEx, LogType.Error);
            }
            return result;
        }

        public DataSet GetAllSku(string whLoginID, PubParasInfo pubParasInfo)
        {
            string sql = this.SQL_SELECT_ALL_SKU.Replace("@_@", whLoginID);
            SqlParameter[] paras = new SqlParameter[] { new SqlParameter("@USER_ID", pubParasInfo.UserID) };
            return DBHelper.ExecuteDataSet(CommandType.Text, sql, paras);
        }

        public DataSet GetAllSku(DataBase dataBase, DbTransaction tran, string whLoginID, PubParasInfo pubParasInfo)
        {
            string sql = this.SQL_SELECT_ALL_SKU.Replace("@_@", whLoginID);
            SqlParameter[] paras = new SqlParameter[] { new SqlParameter("@USER_ID", pubParasInfo.UserID) };
            return dataBase.ExecuteDataSet(tran, CommandType.Text, sql, paras);
        }

        public SkuInfo GetSkuByBarcode(string Barcode, string whLoginID, PubParasInfo pubParasInfo)
        {
            string sql = this.SQL_SELECT_ALL_SKU.Replace("@_@", whLoginID) + "WHERE (B_UDF1=@B_UDF OR B_UDF2=@B_UDF OR B_UDF3=@B_UDF OR B_UDF4=@B_UDF OR B_UDF5=@B_UDF OR B_UDF6=@B_UDF OR B_UDF7=@B_UDF OR B_UDF8=@B_UDF OR B_UDF9=@B_UDF OR B_UDF10=@B_UDF ) ";
            SqlParameter[] paras = new SqlParameter[] { new SqlParameter("@B_UDF", Barcode), new SqlParameter("@USER_ID", pubParasInfo.UserID) };
            SkuInfo skuInfo = null;
            using (IDataReader reader = DBHelper.ExecuteReader(CommandType.Text, sql, paras))
            {
                if (reader.Read())
                {
                    DateTime CS00003;
                    skuInfo = new SkuInfo((reader["ROWID"].ToString() != "") ? int.Parse(reader["ROWID"].ToString()) : 0, reader["WH_ID"].ToString(), reader["OWNER_ID"].ToString(), reader["SKU_ID"].ToString(), reader["DESCR"].ToString(), reader["DESCR2"].ToString(), reader["PACK_ID"].ToString(), reader["CARTON_GROUP"].ToString(), reader["LOT_TEMPLATE_ID"].ToString(), reader["TARIFF_ID"].ToString(), reader["SKU_CLASS_ID"].ToString(), reader["HAZMAT_CODE"].ToString(), reader["CUSTOM_SKU_NO"].ToString(), reader["COUNTRY_OF_ORIGIN"].ToString(), reader["SHELF_LIFE_INDICATOR"].ToString(), reader["SHELF_LIFE_CODE_TYPE"].ToString(), (reader["SHELF_LIFE_ON_RECEIVING"].ToString() != "") ? int.Parse(reader["SHELF_LIFE_ON_RECEIVING"].ToString()) : 0, (reader["SHELF_LIFE"].ToString() != "") ? int.Parse(reader["SHELF_LIFE"].ToString()) : 0, (reader["DAYS_TO_EXPIRE"].ToString() != "") ? int.Parse(reader["DAYS_TO_EXPIRE"].ToString()) : 0, (reader["LENGTH"].ToString() != "") ? float.Parse(reader["LENGTH"].ToString()) : 0f, (reader["WIDTH"].ToString() != "") ? float.Parse(reader["WIDTH"].ToString()) : 0f, (reader["HEIGHT"].ToString() != "") ? float.Parse(reader["HEIGHT"].ToString()) : 0f, (reader["CUBE"].ToString() != "") ? float.Parse(reader["CUBE"].ToString()) : 0f, (reader["GROSS_WGT"].ToString() != "") ? float.Parse(reader["GROSS_WGT"].ToString()) : 0f, (reader["NET_WGT"].ToString() != "") ? float.Parse(reader["NET_WGT"].ToString()) : 0f, (reader["TARE_WGT"].ToString() != "") ? float.Parse(reader["TARE_WGT"].ToString()) : 0f, reader["SKU_SIZE"].ToString(), reader["SKU_COLOR"].ToString(), reader["SKU_STYLE"].ToString(), (reader["COST_PRICE"].ToString() != "") ? decimal.Parse(reader["COST_PRICE"].ToString()) : 0M, (reader["SALE_PRICE"].ToString() != "") ? decimal.Parse(reader["SALE_PRICE"].ToString()) : 0M, (reader["NET_PRICE"].ToString() != "") ? decimal.Parse(reader["NET_PRICE"].ToString()) : 0M, reader["IS_SALE_PROMPTION"].ToString(), reader["RECEIPT_VALIDATION_TEMPLATE"].ToString(), reader["DEFAULT_IN_UOM"].ToString(), reader["DEFAULT_OUT_UOM"].ToString(), reader["RF_DEFAULT_PACK"].ToString(), reader["PUTAWAY_RULE_ID"].ToString(), reader["PREALLOCATE_RULE_ID"].ToString(), reader["ALLOCATE_RULE_ID"].ToString(), reader["ROTATION_RULE_ID"].ToString(), reader["CALCULATE_PUTAWAY_LOCATION"].ToString(), reader["RECEIPT_VALIDATION_ID"].ToString(), reader["ZONE_ID"].ToString(), reader["PUTAWAY_LOC"].ToString(), reader["RECEIPT_INSPECTION_LOC"].ToString(), reader["QC_LOC_OUT"].ToString(), reader["RETURNS_LOC"].ToString(), reader["QC_LOC"].ToString(), (reader["MAX_QTY"].ToString() != "") ? decimal.Parse(reader["MAX_QTY"].ToString()) : 0M, (reader["MIN_QTY"].ToString() != "") ? decimal.Parse(reader["MIN_QTY"].ToString()) : 0M, (reader["REORDER_POINT"].ToString() != "") ? int.Parse(reader["REORDER_POINT"].ToString()) : 0, (reader["REORDER_QTY"].ToString() != "") ? decimal.Parse(reader["REORDER_QTY"].ToString()) : 0M, (reader["STD_ORDER_COST"].ToString() != "") ? float.Parse(reader["STD_ORDER_COST"].ToString()) : 0f, (reader["CARRY_COST"].ToString() != "") ? float.Parse(reader["CARRY_COST"].ToString()) : 0f, reader["ABC"].ToString(), (reader["CYCLE_COUNT_FREQUENCY"].ToString() != "") ? int.Parse(reader["CYCLE_COUNT_FREQUENCY"].ToString()) : 0, (reader["LAST_CYCLE_COUNT"].ToString() != "") ? DateTime.Parse(reader["LAST_CYCLE_COUNT"].ToString()) : (CS00003 = new DateTime()), reader["CC_DISCREPAN_CYRULE"].ToString(), reader["SKU_GROUP"].ToString(), reader["SKU_GROUP2"].ToString(), reader["TRANSPORT_MODE"].ToString(), reader["FREIGHT_CLASS"].ToString(), reader["UDF1"].ToString(), reader["UDF2"].ToString(), reader["UDF3"].ToString(), reader["UDF4"].ToString(), reader["UDF5"].ToString(), reader["UDF6"].ToString(), reader["UDF7"].ToString(), reader["UDF8"].ToString(), reader["UDF9"].ToString(), reader["UDF10"].ToString(), reader["B_UDF1"].ToString(), reader["B_UDF2"].ToString(), reader["B_UDF3"].ToString(), reader["B_UDF4"].ToString(), reader["B_UDF5"].ToString(), reader["B_UDF6"].ToString(), reader["B_UDF7"].ToString(), reader["B_UDF8"].ToString(), reader["B_UDF9"].ToString(), reader["B_UDF10"].ToString(), reader["REMARK1"].ToString(), reader["REMARK2"].ToString(), reader["IS_ACTIVE"].ToString(), (byte[]) reader["TS"], reader["CREATED_BY"].ToString(), (reader["CREATED_DATE"].ToString() != "") ? DateTime.Parse(reader["CREATED_DATE"].ToString()) : (CS00003 = new DateTime()), reader["UPDATED_BY"].ToString(), (reader["UPDATED_DATE"].ToString() != "") ? DateTime.Parse(reader["UPDATED_DATE"].ToString()) : new DateTime(), reader["ITEM_NO_ID"].ToString());
                }
            }
            return skuInfo;
        }

        public SkuInfo GetSkuByID(string ownerID, string skuID, string whLoginID)
        {
            string sql = " SELECT  SKU.ROWID AS ROWID, SKU.WH_ID AS WH_ID, SKU.OWNER_ID AS OWNER_ID, SKU.SKU_ID AS SKU_ID, SKU.DESCR AS DESCR, SKU.DESCR2 AS DESCR2, SKU.PACK_ID AS PACK_ID, SKU.CARTON_GROUP AS CARTON_GROUP, SKU.LOT_TEMPLATE_ID AS LOT_TEMPLATE_ID, SKU.TARIFF_ID AS TARIFF_ID, SKU.SKU_CLASS_ID AS SKU_CLASS_ID, SKU.HAZMAT_CODE AS HAZMAT_CODE, SKU.CUSTOM_SKU_NO AS CUSTOM_SKU_NO, SKU.COUNTRY_OF_ORIGIN AS COUNTRY_OF_ORIGIN, SKU.SHELF_LIFE_INDICATOR AS SHELF_LIFE_INDICATOR, SKU.SHELF_LIFE_CODE_TYPE AS SHELF_LIFE_CODE_TYPE, SKU.SHELF_LIFE_ON_RECEIVING AS SHELF_LIFE_ON_RECEIVING, SKU.SHELF_LIFE AS SHELF_LIFE, SKU.DAYS_TO_EXPIRE AS DAYS_TO_EXPIRE, SKU.LENGTH AS LENGTH, SKU.WIDTH AS WIDTH, SKU.HEIGHT AS HEIGHT, SKU.CUBE AS CUBE, SKU.GROSS_WGT AS GROSS_WGT, SKU.NET_WGT AS NET_WGT, SKU.TARE_WGT AS TARE_WGT, SKU.SKU_SIZE AS SKU_SIZE, SKU.SKU_COLOR AS SKU_COLOR, SKU.SKU_STYLE AS SKU_STYLE, SKU.COST_PRICE AS COST_PRICE, SKU.SALE_PRICE AS SALE_PRICE, SKU.NET_PRICE AS NET_PRICE, SKU.IS_SALE_PROMPTION AS IS_SALE_PROMPTION, SKU.RECEIPT_VALIDATION_TEMPLATE AS RECEIPT_VALIDATION_TEMPLATE, SKU.DEFAULT_IN_UOM AS DEFAULT_IN_UOM,SKU.ITEM_NO_ID AS ITEM_NO_ID,  SKU.DEFAULT_OUT_UOM AS DEFAULT_OUT_UOM, SKU.RF_DEFAULT_PACK AS RF_DEFAULT_PACK, SKU.PUTAWAY_RULE_ID AS PUTAWAY_RULE_ID, SKU.PREALLOCATE_RULE_ID AS PREALLOCATE_RULE_ID, SKU.ALLOCATE_RULE_ID AS ALLOCATE_RULE_ID, SKU.ROTATION_RULE_ID AS ROTATION_RULE_ID, SKU.CALCULATE_PUTAWAY_LOCATION AS CALCULATE_PUTAWAY_LOCATION, SKU.RECEIPT_VALIDATION_ID AS RECEIPT_VALIDATION_ID, SKU.ZONE_ID AS ZONE_ID, SKU.PUTAWAY_LOC AS PUTAWAY_LOC, SKU.RECEIPT_INSPECTION_LOC AS RECEIPT_INSPECTION_LOC, SKU.QC_LOC_OUT AS QC_LOC_OUT, SKU.RETURNS_LOC AS RETURNS_LOC, SKU.QC_LOC AS QC_LOC, SKU.MAX_QTY AS MAX_QTY, SKU.MIN_QTY AS MIN_QTY, SKU.REORDER_POINT AS REORDER_POINT, SKU.REORDER_QTY AS REORDER_QTY, SKU.STD_ORDER_COST AS STD_ORDER_COST, SKU.CARRY_COST AS CARRY_COST, SKU.ABC AS ABC, SKU.CYCLE_COUNT_FREQUENCY AS CYCLE_COUNT_FREQUENCY, SKU.LAST_CYCLE_COUNT AS LAST_CYCLE_COUNT, SKU.CC_DISCREPAN_CYRULE AS CC_DISCREPAN_CYRULE, SKU.SKU_GROUP AS SKU_GROUP, SKU.SKU_GROUP2 AS SKU_GROUP2, SKU.TRANSPORT_MODE AS TRANSPORT_MODE, SKU.FREIGHT_CLASS AS FREIGHT_CLASS, SKU.IS_ASSEMBLED AS IS_ASSEMBLED, SKU.UDF1 AS UDF1, SKU.UDF2 AS UDF2, SKU.UDF3 AS UDF3, SKU.UDF4 AS UDF4, SKU.UDF5 AS UDF5, SKU.UDF6 AS UDF6, SKU.UDF7 AS UDF7, SKU.UDF8 AS UDF8, SKU.UDF9 AS UDF9, SKU.UDF10 AS UDF10, SKU.B_UDF1 AS B_UDF1, SKU.B_UDF2 AS B_UDF2, SKU.B_UDF3 AS B_UDF3, SKU.B_UDF4 AS B_UDF4, SKU.B_UDF5 AS B_UDF5, SKU.B_UDF6 AS B_UDF6, SKU.B_UDF7 AS B_UDF7, SKU.B_UDF8 AS B_UDF8, SKU.B_UDF9 AS B_UDF9, SKU.B_UDF10 AS B_UDF10, SKU.REMARK1 AS REMARK1, SKU.REMARK2 AS REMARK2, SKU.IS_ACTIVE AS IS_ACTIVE, SKU.TS AS TS, SKU.CREATED_BY AS CREATED_BY, SKU.CREATED_DATE AS CREATED_DATE, SKU.UPDATED_BY AS UPDATED_BY, SKU.UPDATED_DATE AS UPDATED_DATE FROM @_@SKU SKU ".Replace("@_@", whLoginID) + " WHERE SKU.OWNER_ID = @OWNER_ID AND SKU.SKU_ID = @SKU_ID  ";
            SqlParameter[] paras = new SqlParameter[] { new SqlParameter("@OWNER_ID", ownerID), new SqlParameter("@SKU_ID", skuID) };
            SkuInfo skuInfo = null;
            using (IDataReader reader = DBHelper.ExecuteReader(CommandType.Text, sql, paras))
            {
                if (reader.Read())
                {
                    DateTime CS00003;
                    skuInfo = new SkuInfo((reader["ROWID"].ToString() != "") ? int.Parse(reader["ROWID"].ToString()) : 0, reader["WH_ID"].ToString(), reader["OWNER_ID"].ToString(), reader["SKU_ID"].ToString(), reader["DESCR"].ToString(), reader["DESCR2"].ToString(), reader["PACK_ID"].ToString(), reader["CARTON_GROUP"].ToString(), reader["LOT_TEMPLATE_ID"].ToString(), reader["TARIFF_ID"].ToString(), reader["SKU_CLASS_ID"].ToString(), reader["HAZMAT_CODE"].ToString(), reader["CUSTOM_SKU_NO"].ToString(), reader["COUNTRY_OF_ORIGIN"].ToString(), reader["SHELF_LIFE_INDICATOR"].ToString(), reader["SHELF_LIFE_CODE_TYPE"].ToString(), (reader["SHELF_LIFE_ON_RECEIVING"].ToString() != "") ? int.Parse(reader["SHELF_LIFE_ON_RECEIVING"].ToString()) : 0, (reader["SHELF_LIFE"].ToString() != "") ? int.Parse(reader["SHELF_LIFE"].ToString()) : 0, (reader["DAYS_TO_EXPIRE"].ToString() != "") ? int.Parse(reader["DAYS_TO_EXPIRE"].ToString()) : 0, (reader["LENGTH"].ToString() != "") ? float.Parse(reader["LENGTH"].ToString()) : 0f, (reader["WIDTH"].ToString() != "") ? float.Parse(reader["WIDTH"].ToString()) : 0f, (reader["HEIGHT"].ToString() != "") ? float.Parse(reader["HEIGHT"].ToString()) : 0f, (reader["CUBE"].ToString() != "") ? float.Parse(reader["CUBE"].ToString()) : 0f, (reader["GROSS_WGT"].ToString() != "") ? float.Parse(reader["GROSS_WGT"].ToString()) : 0f, (reader["NET_WGT"].ToString() != "") ? float.Parse(reader["NET_WGT"].ToString()) : 0f, (reader["TARE_WGT"].ToString() != "") ? float.Parse(reader["TARE_WGT"].ToString()) : 0f, reader["SKU_SIZE"].ToString(), reader["SKU_COLOR"].ToString(), reader["SKU_STYLE"].ToString(), (reader["COST_PRICE"].ToString() != "") ? decimal.Parse(reader["COST_PRICE"].ToString()) : 0M, (reader["SALE_PRICE"].ToString() != "") ? decimal.Parse(reader["SALE_PRICE"].ToString()) : 0M, (reader["NET_PRICE"].ToString() != "") ? decimal.Parse(reader["NET_PRICE"].ToString()) : 0M, reader["IS_SALE_PROMPTION"].ToString(), reader["RECEIPT_VALIDATION_TEMPLATE"].ToString(), reader["DEFAULT_IN_UOM"].ToString(), reader["DEFAULT_OUT_UOM"].ToString(), reader["RF_DEFAULT_PACK"].ToString(), reader["PUTAWAY_RULE_ID"].ToString(), reader["PREALLOCATE_RULE_ID"].ToString(), reader["ALLOCATE_RULE_ID"].ToString(), reader["ROTATION_RULE_ID"].ToString(), reader["CALCULATE_PUTAWAY_LOCATION"].ToString(), reader["RECEIPT_VALIDATION_ID"].ToString(), reader["ZONE_ID"].ToString(), reader["PUTAWAY_LOC"].ToString(), reader["RECEIPT_INSPECTION_LOC"].ToString(), reader["QC_LOC_OUT"].ToString(), reader["RETURNS_LOC"].ToString(), reader["QC_LOC"].ToString(), (reader["MAX_QTY"].ToString() != "") ? decimal.Parse(reader["MAX_QTY"].ToString()) : 0M, (reader["MIN_QTY"].ToString() != "") ? decimal.Parse(reader["MIN_QTY"].ToString()) : 0M, (reader["REORDER_POINT"].ToString() != "") ? int.Parse(reader["REORDER_POINT"].ToString()) : 0, (reader["REORDER_QTY"].ToString() != "") ? decimal.Parse(reader["REORDER_QTY"].ToString()) : 0M, (reader["STD_ORDER_COST"].ToString() != "") ? float.Parse(reader["STD_ORDER_COST"].ToString()) : 0f, (reader["CARRY_COST"].ToString() != "") ? float.Parse(reader["CARRY_COST"].ToString()) : 0f, reader["ABC"].ToString(), (reader["CYCLE_COUNT_FREQUENCY"].ToString() != "") ? int.Parse(reader["CYCLE_COUNT_FREQUENCY"].ToString()) : 0, (reader["LAST_CYCLE_COUNT"].ToString() != "") ? DateTime.Parse(reader["LAST_CYCLE_COUNT"].ToString()) : (CS00003 = new DateTime()), reader["CC_DISCREPAN_CYRULE"].ToString(), reader["SKU_GROUP"].ToString(), reader["SKU_GROUP2"].ToString(), reader["TRANSPORT_MODE"].ToString(), reader["FREIGHT_CLASS"].ToString(), reader["UDF1"].ToString(), reader["UDF2"].ToString(), reader["UDF3"].ToString(), reader["UDF4"].ToString(), reader["UDF5"].ToString(), reader["UDF6"].ToString(), reader["UDF7"].ToString(), reader["UDF8"].ToString(), reader["UDF9"].ToString(), reader["UDF10"].ToString(), reader["B_UDF1"].ToString(), reader["B_UDF2"].ToString(), reader["B_UDF3"].ToString(), reader["B_UDF4"].ToString(), reader["B_UDF5"].ToString(), reader["B_UDF6"].ToString(), reader["B_UDF7"].ToString(), reader["B_UDF8"].ToString(), reader["B_UDF9"].ToString(), reader["B_UDF10"].ToString(), reader["REMARK1"].ToString(), reader["REMARK2"].ToString(), reader["IS_ACTIVE"].ToString(), (byte[]) reader["TS"], reader["CREATED_BY"].ToString(), (reader["CREATED_DATE"].ToString() != "") ? DateTime.Parse(reader["CREATED_DATE"].ToString()) : (CS00003 = new DateTime()), reader["UPDATED_BY"].ToString(), (reader["UPDATED_DATE"].ToString() != "") ? DateTime.Parse(reader["UPDATED_DATE"].ToString()) : new DateTime(), reader["ITEM_NO_ID"].ToString());
                }
            }
            return skuInfo;
        }

        public SkuInfo GetSkuByID(DataBase dataBase, DbTransaction tran, string ownerID, string skuID, string whLoginID)
        {
            string sql = " SELECT  SKU.ROWID AS ROWID, SKU.WH_ID AS WH_ID, SKU.OWNER_ID AS OWNER_ID, SKU.SKU_ID AS SKU_ID, SKU.DESCR AS DESCR, SKU.DESCR2 AS DESCR2, SKU.PACK_ID AS PACK_ID, SKU.CARTON_GROUP AS CARTON_GROUP, SKU.LOT_TEMPLATE_ID AS LOT_TEMPLATE_ID, SKU.TARIFF_ID AS TARIFF_ID, SKU.SKU_CLASS_ID AS SKU_CLASS_ID, SKU.HAZMAT_CODE AS HAZMAT_CODE, SKU.CUSTOM_SKU_NO AS CUSTOM_SKU_NO, SKU.COUNTRY_OF_ORIGIN AS COUNTRY_OF_ORIGIN, SKU.SHELF_LIFE_INDICATOR AS SHELF_LIFE_INDICATOR, SKU.SHELF_LIFE_CODE_TYPE AS SHELF_LIFE_CODE_TYPE, SKU.SHELF_LIFE_ON_RECEIVING AS SHELF_LIFE_ON_RECEIVING, SKU.SHELF_LIFE AS SHELF_LIFE, SKU.DAYS_TO_EXPIRE AS DAYS_TO_EXPIRE,SKU.ITEM_NO_ID AS ITEM_NO_ID, SKU.LENGTH AS LENGTH, SKU.WIDTH AS WIDTH, SKU.HEIGHT AS HEIGHT, SKU.CUBE AS CUBE, SKU.GROSS_WGT AS GROSS_WGT, SKU.NET_WGT AS NET_WGT, SKU.TARE_WGT AS TARE_WGT, SKU.SKU_SIZE AS SKU_SIZE, SKU.SKU_COLOR AS SKU_COLOR, SKU.SKU_STYLE AS SKU_STYLE, SKU.COST_PRICE AS COST_PRICE, SKU.SALE_PRICE AS SALE_PRICE, SKU.NET_PRICE AS NET_PRICE, SKU.IS_SALE_PROMPTION AS IS_SALE_PROMPTION, SKU.RECEIPT_VALIDATION_TEMPLATE AS RECEIPT_VALIDATION_TEMPLATE, SKU.DEFAULT_IN_UOM AS DEFAULT_IN_UOM, SKU.DEFAULT_OUT_UOM AS DEFAULT_OUT_UOM, SKU.RF_DEFAULT_PACK AS RF_DEFAULT_PACK, SKU.PUTAWAY_RULE_ID AS PUTAWAY_RULE_ID, SKU.PREALLOCATE_RULE_ID AS PREALLOCATE_RULE_ID, SKU.ALLOCATE_RULE_ID AS ALLOCATE_RULE_ID, SKU.ROTATION_RULE_ID AS ROTATION_RULE_ID, SKU.CALCULATE_PUTAWAY_LOCATION AS CALCULATE_PUTAWAY_LOCATION, SKU.RECEIPT_VALIDATION_ID AS RECEIPT_VALIDATION_ID, SKU.ZONE_ID AS ZONE_ID, SKU.PUTAWAY_LOC AS PUTAWAY_LOC, SKU.RECEIPT_INSPECTION_LOC AS RECEIPT_INSPECTION_LOC, SKU.QC_LOC_OUT AS QC_LOC_OUT, SKU.RETURNS_LOC AS RETURNS_LOC, SKU.QC_LOC AS QC_LOC, SKU.MAX_QTY AS MAX_QTY, SKU.MIN_QTY AS MIN_QTY, SKU.REORDER_POINT AS REORDER_POINT, SKU.REORDER_QTY AS REORDER_QTY, SKU.STD_ORDER_COST AS STD_ORDER_COST, SKU.CARRY_COST AS CARRY_COST, SKU.ABC AS ABC, SKU.CYCLE_COUNT_FREQUENCY AS CYCLE_COUNT_FREQUENCY, SKU.LAST_CYCLE_COUNT AS LAST_CYCLE_COUNT, SKU.CC_DISCREPAN_CYRULE AS CC_DISCREPAN_CYRULE, SKU.SKU_GROUP AS SKU_GROUP, SKU.SKU_GROUP2 AS SKU_GROUP2, SKU.TRANSPORT_MODE AS TRANSPORT_MODE, SKU.FREIGHT_CLASS AS FREIGHT_CLASS, SKU.IS_ASSEMBLED AS IS_ASSEMBLED, SKU.UDF1 AS UDF1, SKU.UDF2 AS UDF2, SKU.UDF3 AS UDF3, SKU.UDF4 AS UDF4, SKU.UDF5 AS UDF5, SKU.UDF6 AS UDF6, SKU.UDF7 AS UDF7, SKU.UDF8 AS UDF8, SKU.UDF9 AS UDF9, SKU.UDF10 AS UDF10, SKU.B_UDF1 AS B_UDF1, SKU.B_UDF2 AS B_UDF2, SKU.B_UDF3 AS B_UDF3, SKU.B_UDF4 AS B_UDF4, SKU.B_UDF5 AS B_UDF5, SKU.B_UDF6 AS B_UDF6, SKU.B_UDF7 AS B_UDF7, SKU.B_UDF8 AS B_UDF8, SKU.B_UDF9 AS B_UDF9, SKU.B_UDF10 AS B_UDF10, SKU.REMARK1 AS REMARK1, SKU.REMARK2 AS REMARK2, SKU.IS_ACTIVE AS IS_ACTIVE, SKU.TS AS TS, SKU.CREATED_BY AS CREATED_BY, SKU.CREATED_DATE AS CREATED_DATE, SKU.UPDATED_BY AS UPDATED_BY, SKU.UPDATED_DATE AS UPDATED_DATE FROM @_@SKU SKU ".Replace("@_@", whLoginID) + " WHERE SKU.OWNER_ID = @OWNER_ID AND SKU.SKU_ID = @SKU_ID  ";
            SqlParameter[] paras = new SqlParameter[] { new SqlParameter("@OWNER_ID", ownerID), new SqlParameter("@SKU_ID", skuID) };
            SkuInfo skuInfo = null;
            IDataReader reader = dataBase.ExecuteReader(tran, CommandType.Text, sql, paras);
            if (reader.Read())
            {
                DateTime CS00003;
                skuInfo = new SkuInfo((reader["ROWID"].ToString() != "") ? int.Parse(reader["ROWID"].ToString()) : 0, reader["WH_ID"].ToString(), reader["OWNER_ID"].ToString(), reader["SKU_ID"].ToString(), reader["DESCR"].ToString(), reader["DESCR2"].ToString(), reader["PACK_ID"].ToString(), reader["CARTON_GROUP"].ToString(), reader["LOT_TEMPLATE_ID"].ToString(), reader["TARIFF_ID"].ToString(), reader["SKU_CLASS_ID"].ToString(), reader["HAZMAT_CODE"].ToString(), reader["CUSTOM_SKU_NO"].ToString(), reader["COUNTRY_OF_ORIGIN"].ToString(), reader["SHELF_LIFE_INDICATOR"].ToString(), reader["SHELF_LIFE_CODE_TYPE"].ToString(), (reader["SHELF_LIFE_ON_RECEIVING"].ToString() != "") ? int.Parse(reader["SHELF_LIFE_ON_RECEIVING"].ToString()) : 0, (reader["SHELF_LIFE"].ToString() != "") ? int.Parse(reader["SHELF_LIFE"].ToString()) : 0, (reader["DAYS_TO_EXPIRE"].ToString() != "") ? int.Parse(reader["DAYS_TO_EXPIRE"].ToString()) : 0, (reader["LENGTH"].ToString() != "") ? float.Parse(reader["LENGTH"].ToString()) : 0f, (reader["WIDTH"].ToString() != "") ? float.Parse(reader["WIDTH"].ToString()) : 0f, (reader["HEIGHT"].ToString() != "") ? float.Parse(reader["HEIGHT"].ToString()) : 0f, (reader["CUBE"].ToString() != "") ? float.Parse(reader["CUBE"].ToString()) : 0f, (reader["GROSS_WGT"].ToString() != "") ? float.Parse(reader["GROSS_WGT"].ToString()) : 0f, (reader["NET_WGT"].ToString() != "") ? float.Parse(reader["NET_WGT"].ToString()) : 0f, (reader["TARE_WGT"].ToString() != "") ? float.Parse(reader["TARE_WGT"].ToString()) : 0f, reader["SKU_SIZE"].ToString(), reader["SKU_COLOR"].ToString(), reader["SKU_STYLE"].ToString(), (reader["COST_PRICE"].ToString() != "") ? decimal.Parse(reader["COST_PRICE"].ToString()) : 0M, (reader["SALE_PRICE"].ToString() != "") ? decimal.Parse(reader["SALE_PRICE"].ToString()) : 0M, (reader["NET_PRICE"].ToString() != "") ? decimal.Parse(reader["NET_PRICE"].ToString()) : 0M, reader["IS_SALE_PROMPTION"].ToString(), reader["RECEIPT_VALIDATION_TEMPLATE"].ToString(), reader["DEFAULT_IN_UOM"].ToString(), reader["DEFAULT_OUT_UOM"].ToString(), reader["RF_DEFAULT_PACK"].ToString(), reader["PUTAWAY_RULE_ID"].ToString(), reader["PREALLOCATE_RULE_ID"].ToString(), reader["ALLOCATE_RULE_ID"].ToString(), reader["ROTATION_RULE_ID"].ToString(), reader["CALCULATE_PUTAWAY_LOCATION"].ToString(), reader["RECEIPT_VALIDATION_ID"].ToString(), reader["ZONE_ID"].ToString(), reader["PUTAWAY_LOC"].ToString(), reader["RECEIPT_INSPECTION_LOC"].ToString(), reader["QC_LOC_OUT"].ToString(), reader["RETURNS_LOC"].ToString(), reader["QC_LOC"].ToString(), (reader["MAX_QTY"].ToString() != "") ? decimal.Parse(reader["MAX_QTY"].ToString()) : 0M, (reader["MIN_QTY"].ToString() != "") ? decimal.Parse(reader["MIN_QTY"].ToString()) : 0M, (reader["REORDER_POINT"].ToString() != "") ? int.Parse(reader["REORDER_POINT"].ToString()) : 0, (reader["REORDER_QTY"].ToString() != "") ? decimal.Parse(reader["REORDER_QTY"].ToString()) : 0M, (reader["STD_ORDER_COST"].ToString() != "") ? float.Parse(reader["STD_ORDER_COST"].ToString()) : 0f, (reader["CARRY_COST"].ToString() != "") ? float.Parse(reader["CARRY_COST"].ToString()) : 0f, reader["ABC"].ToString(), (reader["CYCLE_COUNT_FREQUENCY"].ToString() != "") ? int.Parse(reader["CYCLE_COUNT_FREQUENCY"].ToString()) : 0, (reader["LAST_CYCLE_COUNT"].ToString() != "") ? DateTime.Parse(reader["LAST_CYCLE_COUNT"].ToString()) : (CS00003 = new DateTime()), reader["CC_DISCREPAN_CYRULE"].ToString(), reader["SKU_GROUP"].ToString(), reader["SKU_GROUP2"].ToString(), reader["TRANSPORT_MODE"].ToString(), reader["FREIGHT_CLASS"].ToString(), reader["UDF1"].ToString(), reader["UDF2"].ToString(), reader["UDF3"].ToString(), reader["UDF4"].ToString(), reader["UDF5"].ToString(), reader["UDF6"].ToString(), reader["UDF7"].ToString(), reader["UDF8"].ToString(), reader["UDF9"].ToString(), reader["UDF10"].ToString(), reader["B_UDF1"].ToString(), reader["B_UDF2"].ToString(), reader["B_UDF3"].ToString(), reader["B_UDF4"].ToString(), reader["B_UDF5"].ToString(), reader["B_UDF6"].ToString(), reader["B_UDF7"].ToString(), reader["B_UDF8"].ToString(), reader["B_UDF9"].ToString(), reader["B_UDF10"].ToString(), reader["REMARK1"].ToString(), reader["REMARK2"].ToString(), reader["IS_ACTIVE"].ToString(), (byte[]) reader["TS"], reader["CREATED_BY"].ToString(), (reader["CREATED_DATE"].ToString() != "") ? DateTime.Parse(reader["CREATED_DATE"].ToString()) : (CS00003 = new DateTime()), reader["UPDATED_BY"].ToString(), (reader["UPDATED_DATE"].ToString() != "") ? DateTime.Parse(reader["UPDATED_DATE"].ToString()) : new DateTime(), reader["ITEM_NO_ID"].ToString());
            }
            if (!reader.IsClosed)
            {
                reader.Close();
            }
            return skuInfo;
        }

        public DataSet GetSkuByQueryList(List<string> sqlWhere, SkuQueryEntity skuQuery, string whLoginID, PubParasInfo pubParasInfo)
        {
            string temp = this.SQL_SELECT_ALL_SKU.Replace("@_@", whLoginID);
            for (int i = 0; i < sqlWhere.Count; i++)
            {
                if (i == 0)
                {
                    temp = temp + " WHERE " + sqlWhere[i].ToString();
                }
                else
                {
                    temp = temp + " AND " + sqlWhere[i].ToString();
                }
            }
            if (!skuQuery.IsGetAll)
            {
                temp = PagingHelper.GetPagingSQL(temp, skuQuery.CurrentPage, skuQuery.PageSize, skuQuery.SortField, skuQuery.SortDirection).Replace("@USER_ID", "''" + pubParasInfo.UserID + "''");
            }
            else
            {
                temp = temp.Replace("@USER_ID", "'" + pubParasInfo.UserID + "'");
            }
            return DBHelper.ExecuteDataSet(CommandType.Text, temp);
        }

        public DataSet GetSkuByQueryList(DataBase dataBase, DbTransaction tran, List<string> sqlWhere, SkuQueryEntity skuQuery, string whLoginID, PubParasInfo pubParasInfo)
        {
            string temp = this.SQL_SELECT_ALL_SKU.Replace("@_@", whLoginID);
            for (int i = 0; i < sqlWhere.Count; i++)
            {
                if (i == 0)
                {
                    temp = temp + " WHERE " + sqlWhere[i].ToString();
                }
                else
                {
                    temp = temp + " AND " + sqlWhere[i].ToString();
                }
            }
            if (!skuQuery.IsGetAll)
            {
                temp = PagingHelper.GetPagingSQL(temp, skuQuery.CurrentPage, skuQuery.PageSize, skuQuery.SortField, skuQuery.SortDirection).Replace("@USER_ID", "''" + pubParasInfo.UserID + "''");
            }
            else
            {
                temp = temp.Replace("@USER_ID", "'" + pubParasInfo.UserID + "'");
            }
            return dataBase.ExecuteDataSet(tran, CommandType.Text, temp);
        }

        public List<SkuInfo> GetSkuInfosByOwnerIDAndBarCode(string ownerID, string barCode, string whLoginID, PubParasInfo pubParasInfo)
        {
            string sql = this.SQL_SELECT_ALL_SKU.Replace("@_@", whLoginID) + "WHERE SKU.OWNER_ID = @OWNER_ID AND (B_UDF1=@B_UDF OR B_UDF2=@B_UDF OR B_UDF3=@B_UDF OR B_UDF4=@B_UDF OR B_UDF5=@B_UDF OR B_UDF6=@B_UDF OR B_UDF7=@B_UDF OR B_UDF8=@B_UDF OR B_UDF9=@B_UDF OR B_UDF10=@B_UDF ) ";
            SqlParameter[] paras = new SqlParameter[] { new SqlParameter("@OWNER_ID", ownerID), new SqlParameter("@B_UDF", barCode), new SqlParameter("@USER_ID", pubParasInfo.UserID) };
            List<SkuInfo> skuInfoList = new List<SkuInfo>();
            SkuInfo skuInfo = null;
            using (IDataReader reader = DBHelper.ExecuteReader(CommandType.Text, sql, paras))
            {
                while (reader.Read())
                {
                    DateTime CS00002;
                    skuInfo = new SkuInfo((reader["ROWID"].ToString() != "") ? int.Parse(reader["ROWID"].ToString()) : 0, reader["WH_ID"].ToString(), reader["OWNER_ID"].ToString(), reader["SKU_ID"].ToString(), reader["DESCR"].ToString(), reader["DESCR2"].ToString(), reader["PACK_ID"].ToString(), reader["CARTON_GROUP"].ToString(), reader["LOT_TEMPLATE_ID"].ToString(), reader["TARIFF_ID"].ToString(), reader["SKU_CLASS_ID"].ToString(), reader["HAZMAT_CODE"].ToString(), reader["CUSTOM_SKU_NO"].ToString(), reader["COUNTRY_OF_ORIGIN"].ToString(), reader["SHELF_LIFE_INDICATOR"].ToString(), reader["SHELF_LIFE_CODE_TYPE"].ToString(), (reader["SHELF_LIFE_ON_RECEIVING"].ToString() != "") ? int.Parse(reader["SHELF_LIFE_ON_RECEIVING"].ToString()) : 0, (reader["SHELF_LIFE"].ToString() != "") ? int.Parse(reader["SHELF_LIFE"].ToString()) : 0, (reader["DAYS_TO_EXPIRE"].ToString() != "") ? int.Parse(reader["DAYS_TO_EXPIRE"].ToString()) : 0, (reader["LENGTH"].ToString() != "") ? float.Parse(reader["LENGTH"].ToString()) : 0f, (reader["WIDTH"].ToString() != "") ? float.Parse(reader["WIDTH"].ToString()) : 0f, (reader["HEIGHT"].ToString() != "") ? float.Parse(reader["HEIGHT"].ToString()) : 0f, (reader["CUBE"].ToString() != "") ? float.Parse(reader["CUBE"].ToString()) : 0f, (reader["GROSS_WGT"].ToString() != "") ? float.Parse(reader["GROSS_WGT"].ToString()) : 0f, (reader["NET_WGT"].ToString() != "") ? float.Parse(reader["NET_WGT"].ToString()) : 0f, (reader["TARE_WGT"].ToString() != "") ? float.Parse(reader["TARE_WGT"].ToString()) : 0f, reader["SKU_SIZE"].ToString(), reader["SKU_COLOR"].ToString(), reader["SKU_STYLE"].ToString(), (reader["COST_PRICE"].ToString() != "") ? decimal.Parse(reader["COST_PRICE"].ToString()) : 0M, (reader["SALE_PRICE"].ToString() != "") ? decimal.Parse(reader["SALE_PRICE"].ToString()) : 0M, (reader["NET_PRICE"].ToString() != "") ? decimal.Parse(reader["NET_PRICE"].ToString()) : 0M, reader["IS_SALE_PROMPTION"].ToString(), reader["RECEIPT_VALIDATION_TEMPLATE"].ToString(), reader["DEFAULT_IN_UOM"].ToString(), reader["DEFAULT_OUT_UOM"].ToString(), reader["RF_DEFAULT_PACK"].ToString(), reader["PUTAWAY_RULE_ID"].ToString(), reader["PREALLOCATE_RULE_ID"].ToString(), reader["ALLOCATE_RULE_ID"].ToString(), reader["ROTATION_RULE_ID"].ToString(), reader["CALCULATE_PUTAWAY_LOCATION"].ToString(), reader["RECEIPT_VALIDATION_ID"].ToString(), reader["ZONE_ID"].ToString(), reader["PUTAWAY_LOC"].ToString(), reader["RECEIPT_INSPECTION_LOC"].ToString(), reader["QC_LOC_OUT"].ToString(), reader["RETURNS_LOC"].ToString(), reader["QC_LOC"].ToString(), (reader["MAX_QTY"].ToString() != "") ? decimal.Parse(reader["MAX_QTY"].ToString()) : 0M, (reader["MIN_QTY"].ToString() != "") ? decimal.Parse(reader["MIN_QTY"].ToString()) : 0M, (reader["REORDER_POINT"].ToString() != "") ? int.Parse(reader["REORDER_POINT"].ToString()) : 0, (reader["REORDER_QTY"].ToString() != "") ? decimal.Parse(reader["REORDER_QTY"].ToString()) : 0M, (reader["STD_ORDER_COST"].ToString() != "") ? float.Parse(reader["STD_ORDER_COST"].ToString()) : 0f, (reader["CARRY_COST"].ToString() != "") ? float.Parse(reader["CARRY_COST"].ToString()) : 0f, reader["ABC"].ToString(), (reader["CYCLE_COUNT_FREQUENCY"].ToString() != "") ? int.Parse(reader["CYCLE_COUNT_FREQUENCY"].ToString()) : 0, (reader["LAST_CYCLE_COUNT"].ToString() != "") ? DateTime.Parse(reader["LAST_CYCLE_COUNT"].ToString()) : (CS00002 = new DateTime()), reader["CC_DISCREPAN_CYRULE"].ToString(), reader["SKU_GROUP"].ToString(), reader["SKU_GROUP2"].ToString(), reader["TRANSPORT_MODE"].ToString(), reader["FREIGHT_CLASS"].ToString(), reader["UDF1"].ToString(), reader["UDF2"].ToString(), reader["UDF3"].ToString(), reader["UDF4"].ToString(), reader["UDF5"].ToString(), reader["UDF6"].ToString(), reader["UDF7"].ToString(), reader["UDF8"].ToString(), reader["UDF9"].ToString(), reader["UDF10"].ToString(), reader["B_UDF1"].ToString(), reader["B_UDF2"].ToString(), reader["B_UDF3"].ToString(), reader["B_UDF4"].ToString(), reader["B_UDF5"].ToString(), reader["B_UDF6"].ToString(), reader["B_UDF7"].ToString(), reader["B_UDF8"].ToString(), reader["B_UDF9"].ToString(), reader["B_UDF10"].ToString(), reader["REMARK1"].ToString(), reader["REMARK2"].ToString(), reader["IS_ACTIVE"].ToString(), (byte[]) reader["TS"], reader["CREATED_BY"].ToString(), (reader["CREATED_DATE"].ToString() != "") ? DateTime.Parse(reader["CREATED_DATE"].ToString()) : (CS00002 = new DateTime()), reader["UPDATED_BY"].ToString(), (reader["UPDATED_DATE"].ToString() != "") ? DateTime.Parse(reader["UPDATED_DATE"].ToString()) : (CS00002 = new DateTime()), reader["ITEM_NO_ID"].ToString());
                    skuInfoList.Add(skuInfo);
                }
            }
            return skuInfoList;
        }

        public List<SkuInfo> GetSkuListByID(List<string> ownerID, string whLoginID, PubParasInfo pubParasInfo)
        {
            return null;
        }

        public List<SkuInfo> GetSkuListByID(DataBase dataBase, DbTransaction tran, List<string> ownerID, string whLoginID, PubParasInfo pubParasInfo)
        {
            return null;
        }

        public int InsertSku(SkuInfo skuInfo, List<string> whLoginID)
        {
            int result = 0;
            DataBase db = new DataBase();
            DbConnection conn = db.connection;
            conn.Open();
            DbTransaction tran = conn.BeginTransaction();
            try
            {
                for (int i = 0; i < whLoginID.Count; i++)
                {
                    skuInfo.WhID = whLoginID[i].Substring(0, whLoginID[i].Length - 1);
                    SqlParameter[] paras = this.Set_Sku_Parameters(skuInfo);
                    if (paras != null)
                    {
                        result += db.ExecuteNonQuery(tran, CommandType.Text, this.SQL_INSERT_SKU.Replace("@_@", whLoginID[i]), paras);
                    }
                }
                tran.Commit();
            }
            catch (SqlException sqlEx)
            {
                tran.Rollback();
                CommonErrorHandler.ErrorHandler(sqlEx, LogType.Error);
            }
            finally
            {
                conn.Close();
            }
            return result;
        }

        public int InsertSku(DataBase dataBase, DbTransaction tran, SkuInfo skuInfo, List<string> whLoginID)
        {
            int result = 0;
            try
            {
                for (int i = 0; i < whLoginID.Count; i++)
                {
                    skuInfo.WhID = whLoginID[i].Substring(0, whLoginID[i].Length - 1);
                    SqlParameter[] paras = this.Set_Sku_Parameters(skuInfo);
                    if (paras != null)
                    {
                        result += dataBase.ExecuteNonQuery(tran, CommandType.Text, this.SQL_INSERT_SKU.Replace("@_@", whLoginID[i]), paras);
                    }
                }
            }
            catch (SqlException sqlEx)
            {
                CommonErrorHandler.ErrorHandler(sqlEx, LogType.Error);
            }
            return result;
        }

        private SqlParameter[] Set_Sku_Parameters(SkuInfo skuInfo)
        {
            SqlParameter[] paramArray = new SqlParameter[] { 
                new SqlParameter(this.WH_ID, SqlDbType.VarChar, 30), new SqlParameter(this.OWNER_ID, SqlDbType.VarChar, 20), new SqlParameter(this.SKU_ID, SqlDbType.VarChar, 50), new SqlParameter(this.DESCR, SqlDbType.VarChar, 100), new SqlParameter(this.DESCR2, SqlDbType.VarChar, 100), new SqlParameter(this.PACK_ID, SqlDbType.VarChar, 50), new SqlParameter(this.CARTON_GROUP, SqlDbType.VarChar, 20), new SqlParameter(this.LOT_TEMPLATE_ID, SqlDbType.VarChar, 20), new SqlParameter(this.TARIFF_ID, SqlDbType.VarChar, 20), new SqlParameter(this.SKU_CLASS_ID, SqlDbType.VarChar, 20), new SqlParameter(this.HAZMAT_CODE, SqlDbType.VarChar, 20), new SqlParameter(this.CUSTOM_SKU_NO, SqlDbType.VarChar, 50), new SqlParameter(this.COUNTRY_OF_ORIGIN, SqlDbType.VarChar, 30), new SqlParameter(this.SHELF_LIFE_INDICATOR, SqlDbType.VarChar, 1), new SqlParameter(this.SHELF_LIFE_CODE_TYPE, SqlDbType.VarChar, 1), new SqlParameter(this.SHELF_LIFE_ON_RECEIVING, SqlDbType.Int, 4), 
                new SqlParameter(this.SHELF_LIFE, SqlDbType.Int, 4), new SqlParameter(this.LENGTH, SqlDbType.Float, 8), new SqlParameter(this.WIDTH, SqlDbType.Float, 8), new SqlParameter(this.HEIGHT, SqlDbType.Float, 8), new SqlParameter(this.CUBE, SqlDbType.Float, 8), new SqlParameter(this.GROSS_WGT, SqlDbType.Float, 8), new SqlParameter(this.NET_WGT, SqlDbType.Float, 8), new SqlParameter(this.TARE_WGT, SqlDbType.Float, 8), new SqlParameter(this.SKU_SIZE, SqlDbType.VarChar, 20), new SqlParameter(this.SKU_COLOR, SqlDbType.VarChar, 20), new SqlParameter(this.SKU_STYLE, SqlDbType.VarChar, 100), new SqlParameter(this.COST_PRICE, SqlDbType.Decimal, 9), new SqlParameter(this.SALE_PRICE, SqlDbType.Decimal, 9), new SqlParameter(this.NET_PRICE, SqlDbType.Decimal, 9), new SqlParameter(this.IS_SALE_PROMPTION, SqlDbType.VarChar, 1), new SqlParameter(this.RECEIPT_VALIDATION_TEMPLATE, SqlDbType.VarChar, 20), 
                new SqlParameter(this.DEFAULT_IN_UOM, SqlDbType.VarChar, 20), new SqlParameter(this.DEFAULT_OUT_UOM, SqlDbType.VarChar, 20), new SqlParameter(this.RF_DEFAULT_PACK, SqlDbType.VarChar, 50), new SqlParameter(this.PUTAWAY_RULE_ID, SqlDbType.VarChar, 20), new SqlParameter(this.PREALLOCATE_RULE_ID, SqlDbType.VarChar, 20), new SqlParameter(this.ALLOCATE_RULE_ID, SqlDbType.VarChar, 20), new SqlParameter(this.ROTATION_RULE_ID, SqlDbType.VarChar, 20), new SqlParameter(this.CALCULATE_PUTAWAY_LOCATION, SqlDbType.VarChar, 20), new SqlParameter(this.RECEIPT_VALIDATION_ID, SqlDbType.VarChar, 20), new SqlParameter(this.ZONE_ID, SqlDbType.VarChar, 20), new SqlParameter(this.PUTAWAY_LOC, SqlDbType.VarChar, 20), new SqlParameter(this.RECEIPT_INSPECTION_LOC, SqlDbType.VarChar, 20), new SqlParameter(this.QC_LOC_OUT, SqlDbType.VarChar, 20), new SqlParameter(this.RETURNS_LOC, SqlDbType.VarChar, 20), new SqlParameter(this.QC_LOC, SqlDbType.VarChar, 20), new SqlParameter(this.MAX_QTY, SqlDbType.Decimal, 13), 
                new SqlParameter(this.MIN_QTY, SqlDbType.Decimal, 13), new SqlParameter(this.REORDER_POINT, SqlDbType.Int, 4), new SqlParameter(this.REORDER_QTY, SqlDbType.Decimal, 13), new SqlParameter(this.STD_ORDER_COST, SqlDbType.Float, 8), new SqlParameter(this.CARRY_COST, SqlDbType.Float, 8), new SqlParameter(this.ABC, SqlDbType.VarChar, 20), new SqlParameter(this.CYCLE_COUNT_FREQUENCY, SqlDbType.Int, 4), new SqlParameter(this.LAST_CYCLE_COUNT, SqlDbType.DateTime, 8), new SqlParameter(this.CC_DISCREPAN_CYRULE, SqlDbType.VarChar, 20), new SqlParameter(this.SKU_GROUP, SqlDbType.VarChar, 30), new SqlParameter(this.SKU_GROUP2, SqlDbType.VarChar, 30), new SqlParameter(this.TRANSPORT_MODE, SqlDbType.VarChar, 30), new SqlParameter(this.FREIGHT_CLASS, SqlDbType.VarChar, 10), new SqlParameter(this.UDF1, SqlDbType.VarChar, 30), new SqlParameter(this.UDF2, SqlDbType.VarChar, 30), new SqlParameter(this.UDF3, SqlDbType.VarChar, 30), 
                new SqlParameter(this.UDF4, SqlDbType.VarChar, 30), new SqlParameter(this.UDF5, SqlDbType.VarChar, 30), new SqlParameter(this.UDF6, SqlDbType.VarChar, 30), new SqlParameter(this.UDF7, SqlDbType.VarChar, 30), new SqlParameter(this.UDF8, SqlDbType.VarChar, 30), new SqlParameter(this.UDF9, SqlDbType.VarChar, 30), new SqlParameter(this.UDF10, SqlDbType.VarChar, 30), new SqlParameter(this.B_UDF1, SqlDbType.VarChar, 30), new SqlParameter(this.B_UDF2, SqlDbType.VarChar, 30), new SqlParameter(this.B_UDF3, SqlDbType.VarChar, 30), new SqlParameter(this.B_UDF4, SqlDbType.VarChar, 30), new SqlParameter(this.B_UDF5, SqlDbType.VarChar, 30), new SqlParameter(this.B_UDF6, SqlDbType.VarChar, 30), new SqlParameter(this.B_UDF7, SqlDbType.VarChar, 30), new SqlParameter(this.B_UDF8, SqlDbType.VarChar, 30), new SqlParameter(this.B_UDF9, SqlDbType.VarChar, 30), 
                new SqlParameter(this.B_UDF10, SqlDbType.VarChar, 30), new SqlParameter(this.REMARK1, SqlDbType.VarChar, 0x3e8), new SqlParameter(this.REMARK2, SqlDbType.VarChar, 0x3e8), new SqlParameter(this.IS_ACTIVE, SqlDbType.VarChar, 1), new SqlParameter(this.CREATED_BY, SqlDbType.VarChar, 20), new SqlParameter(this.UPDATED_BY, SqlDbType.VarChar, 20), new SqlParameter(this.DAYS_TO_EXPIRE, SqlDbType.Int, 4), new SqlParameter(this.ITEM_NO_ID, SqlDbType.VarChar, 50)
             };
            if (!string.IsNullOrEmpty(skuInfo.WhID))
            {
                paramArray[0].Value = skuInfo.WhID;
            }
            else
            {
                paramArray[0].Value = DBNull.Value;
            }
            paramArray[1].Value = skuInfo.OwnerID;
            paramArray[2].Value = skuInfo.SkuID;
            if (!string.IsNullOrEmpty(skuInfo.Descr))
            {
                paramArray[3].Value = skuInfo.Descr;
            }
            else
            {
                paramArray[3].Value = DBNull.Value;
            }
            if (!string.IsNullOrEmpty(skuInfo.Descr2))
            {
                paramArray[4].Value = skuInfo.Descr2;
            }
            else
            {
                paramArray[4].Value = DBNull.Value;
            }
            paramArray[5].Value = skuInfo.PackID;
            paramArray[6].Value = skuInfo.CartonGroup;
            paramArray[7].Value = skuInfo.LotTemplateID;
            if (!string.IsNullOrEmpty(skuInfo.TariffID))
            {
                paramArray[8].Value = skuInfo.TariffID;
            }
            else
            {
                paramArray[8].Value = DBNull.Value;
            }
            paramArray[9].Value = skuInfo.SkuClassID;
            paramArray[10].Value = skuInfo.HazmatCode;
            if (!string.IsNullOrEmpty(skuInfo.CustomSkuNo))
            {
                paramArray[11].Value = skuInfo.CustomSkuNo;
            }
            else
            {
                paramArray[11].Value = DBNull.Value;
            }
            if (!string.IsNullOrEmpty(skuInfo.CountryOfOrigin))
            {
                paramArray[12].Value = skuInfo.CountryOfOrigin;
            }
            else
            {
                paramArray[12].Value = DBNull.Value;
            }
            if (!string.IsNullOrEmpty(skuInfo.ShelfLifeIndicator))
            {
                paramArray[13].Value = skuInfo.ShelfLifeIndicator;
            }
            else
            {
                paramArray[13].Value = DBNull.Value;
            }
            paramArray[14].Value = skuInfo.ShelfLifeCodeType;
            paramArray[15].Value = skuInfo.ShelfLifeOnReceiving;
            paramArray[0x10].Value = skuInfo.ShelfLife;
            paramArray[0x11].Value = skuInfo.Length;
            paramArray[0x12].Value = skuInfo.Width;
            paramArray[0x13].Value = skuInfo.Height;
            paramArray[20].Value = skuInfo.Cube;
            paramArray[0x15].Value = skuInfo.GrossWgt;
            paramArray[0x16].Value = skuInfo.NetWgt;
            paramArray[0x17].Value = skuInfo.TareWgt;
            if (!string.IsNullOrEmpty(skuInfo.SkuSize))
            {
                paramArray[0x18].Value = skuInfo.SkuSize;
            }
            else
            {
                paramArray[0x18].Value = DBNull.Value;
            }
            if (!string.IsNullOrEmpty(skuInfo.SkuColor))
            {
                paramArray[0x19].Value = skuInfo.SkuColor;
            }
            else
            {
                paramArray[0x19].Value = DBNull.Value;
            }
            if (!string.IsNullOrEmpty(skuInfo.SkuStyle))
            {
                paramArray[0x1a].Value = skuInfo.SkuStyle;
            }
            else
            {
                paramArray[0x1a].Value = DBNull.Value;
            }
            paramArray[0x1b].Value = skuInfo.CostPrice;
            paramArray[0x1c].Value = skuInfo.SalePrice;
            paramArray[0x1d].Value = skuInfo.NetPrice;
            paramArray[30].Value = skuInfo.IsSalePromption;
            paramArray[0x1f].Value = skuInfo.ReceiptValidationTemplate;
            if (!string.IsNullOrEmpty(skuInfo.DefaultInUom))
            {
                paramArray[0x20].Value = skuInfo.DefaultInUom;
            }
            else
            {
                paramArray[0x20].Value = DBNull.Value;
            }
            if (!string.IsNullOrEmpty(skuInfo.DefaultOutUom))
            {
                paramArray[0x21].Value = skuInfo.DefaultOutUom;
            }
            else
            {
                paramArray[0x21].Value = DBNull.Value;
            }
            if (!string.IsNullOrEmpty(skuInfo.RfDefaultPack))
            {
                paramArray[0x22].Value = skuInfo.RfDefaultPack;
            }
            else
            {
                paramArray[0x22].Value = DBNull.Value;
            }
            if (!string.IsNullOrEmpty(skuInfo.PutawayRuleID))
            {
                paramArray[0x23].Value = skuInfo.PutawayRuleID;
            }
            else
            {
                paramArray[0x23].Value = DBNull.Value;
            }
            if (!string.IsNullOrEmpty(skuInfo.PreallocateRuleID))
            {
                paramArray[0x24].Value = skuInfo.PreallocateRuleID;
            }
            else
            {
                paramArray[0x24].Value = DBNull.Value;
            }
            if (!string.IsNullOrEmpty(skuInfo.AllocateRuleID))
            {
                paramArray[0x25].Value = skuInfo.AllocateRuleID;
            }
            else
            {
                paramArray[0x25].Value = DBNull.Value;
            }
            if (!string.IsNullOrEmpty(skuInfo.RotationRuleID))
            {
                paramArray[0x26].Value = skuInfo.RotationRuleID;
            }
            else
            {
                paramArray[0x26].Value = DBNull.Value;
            }
            paramArray[0x27].Value = skuInfo.CalculatePutawayLocation;
            paramArray[40].Value = skuInfo.ReceiptValidationID;
            if (!string.IsNullOrEmpty(skuInfo.ZoneID))
            {
                paramArray[0x29].Value = skuInfo.ZoneID;
            }
            else
            {
                paramArray[0x29].Value = DBNull.Value;
            }
            paramArray[0x2a].Value = skuInfo.PutawayLoc;
            paramArray[0x2b].Value = skuInfo.ReceiptInspectionLoc;
            if (!string.IsNullOrEmpty(skuInfo.QcLocOut))
            {
                paramArray[0x2c].Value = skuInfo.QcLocOut;
            }
            else
            {
                paramArray[0x2c].Value = DBNull.Value;
            }
            paramArray[0x2d].Value = skuInfo.ReturnsLoc;
            paramArray[0x2e].Value = skuInfo.QcLoc;
            paramArray[0x2f].Value = skuInfo.MaxQty;
            paramArray[0x30].Value = skuInfo.MinQty;
            paramArray[0x31].Value = skuInfo.ReorderPoint;
            paramArray[50].Value = skuInfo.ReorderQty;
            paramArray[0x33].Value = skuInfo.StdOrderCost;
            paramArray[0x34].Value = skuInfo.CarryCost;
            if (!string.IsNullOrEmpty(skuInfo.Abc))
            {
                paramArray[0x35].Value = skuInfo.Abc;
            }
            else
            {
                paramArray[0x35].Value = DBNull.Value;
            }
            paramArray[0x36].Value = skuInfo.CycleCountFrequency;
            if (skuInfo.LastCycleCount != new DateTime())
            {
                paramArray[0x37].Value = skuInfo.LastCycleCount;
            }
            else
            {
                paramArray[0x37].Value = DBNull.Value;
            }
            paramArray[0x38].Value = skuInfo.CcDiscrepanCyrule;
            paramArray[0x39].Value = skuInfo.SkuGroup;
            if (!string.IsNullOrEmpty(skuInfo.SkuGroup2))
            {
                paramArray[0x3a].Value = skuInfo.SkuGroup2;
            }
            else
            {
                paramArray[0x3a].Value = DBNull.Value;
            }
            if (!string.IsNullOrEmpty(skuInfo.TransportMode))
            {
                paramArray[0x3b].Value = skuInfo.TransportMode;
            }
            else
            {
                paramArray[0x3b].Value = DBNull.Value;
            }
            if (!string.IsNullOrEmpty(skuInfo.FreightClass))
            {
                paramArray[60].Value = skuInfo.FreightClass;
            }
            else
            {
                paramArray[60].Value = DBNull.Value;
            }
            if (!string.IsNullOrEmpty(skuInfo.Udf1))
            {
                paramArray[0x3d].Value = skuInfo.Udf1;
            }
            else
            {
                paramArray[0x3d].Value = DBNull.Value;
            }
            if (!string.IsNullOrEmpty(skuInfo.Udf2))
            {
                paramArray[0x3e].Value = skuInfo.Udf2;
            }
            else
            {
                paramArray[0x3e].Value = DBNull.Value;
            }
            if (!string.IsNullOrEmpty(skuInfo.Udf3))
            {
                paramArray[0x3f].Value = skuInfo.Udf3;
            }
            else
            {
                paramArray[0x3f].Value = DBNull.Value;
            }
            if (!string.IsNullOrEmpty(skuInfo.Udf4))
            {
                paramArray[0x40].Value = skuInfo.Udf4;
            }
            else
            {
                paramArray[0x40].Value = DBNull.Value;
            }
            if (!string.IsNullOrEmpty(skuInfo.Udf5))
            {
                paramArray[0x41].Value = skuInfo.Udf5;
            }
            else
            {
                paramArray[0x41].Value = DBNull.Value;
            }
            if (!string.IsNullOrEmpty(skuInfo.Udf6))
            {
                paramArray[0x42].Value = skuInfo.Udf6;
            }
            else
            {
                paramArray[0x42].Value = DBNull.Value;
            }
            if (!string.IsNullOrEmpty(skuInfo.Udf7))
            {
                paramArray[0x43].Value = skuInfo.Udf7;
            }
            else
            {
                paramArray[0x43].Value = DBNull.Value;
            }
            if (!string.IsNullOrEmpty(skuInfo.Udf8))
            {
                paramArray[0x44].Value = skuInfo.Udf8;
            }
            else
            {
                paramArray[0x44].Value = DBNull.Value;
            }
            if (!string.IsNullOrEmpty(skuInfo.Udf9))
            {
                paramArray[0x45].Value = skuInfo.Udf9;
            }
            else
            {
                paramArray[0x45].Value = DBNull.Value;
            }
            if (!string.IsNullOrEmpty(skuInfo.Udf10))
            {
                paramArray[70].Value = skuInfo.Udf10;
            }
            else
            {
                paramArray[70].Value = DBNull.Value;
            }
            if (!string.IsNullOrEmpty(skuInfo.BUdf1))
            {
                paramArray[0x47].Value = skuInfo.BUdf1;
            }
            else
            {
                paramArray[0x47].Value = DBNull.Value;
            }
            if (!string.IsNullOrEmpty(skuInfo.BUdf2))
            {
                paramArray[0x48].Value = skuInfo.BUdf2;
            }
            else
            {
                paramArray[0x48].Value = DBNull.Value;
            }
            if (!string.IsNullOrEmpty(skuInfo.BUdf3))
            {
                paramArray[0x49].Value = skuInfo.BUdf3;
            }
            else
            {
                paramArray[0x49].Value = DBNull.Value;
            }
            if (!string.IsNullOrEmpty(skuInfo.BUdf4))
            {
                paramArray[0x4a].Value = skuInfo.BUdf4;
            }
            else
            {
                paramArray[0x4a].Value = DBNull.Value;
            }
            if (!string.IsNullOrEmpty(skuInfo.BUdf5))
            {
                paramArray[0x4b].Value = skuInfo.BUdf5;
            }
            else
            {
                paramArray[0x4b].Value = DBNull.Value;
            }
            if (!string.IsNullOrEmpty(skuInfo.BUdf6))
            {
                paramArray[0x4c].Value = skuInfo.BUdf6;
            }
            else
            {
                paramArray[0x4c].Value = DBNull.Value;
            }
            if (!string.IsNullOrEmpty(skuInfo.BUdf7))
            {
                paramArray[0x4d].Value = skuInfo.BUdf7;
            }
            else
            {
                paramArray[0x4d].Value = DBNull.Value;
            }
            if (!string.IsNullOrEmpty(skuInfo.BUdf8))
            {
                paramArray[0x4e].Value = skuInfo.BUdf8;
            }
            else
            {
                paramArray[0x4e].Value = DBNull.Value;
            }
            if (!string.IsNullOrEmpty(skuInfo.BUdf9))
            {
                paramArray[0x4f].Value = skuInfo.BUdf9;
            }
            else
            {
                paramArray[0x4f].Value = DBNull.Value;
            }
            if (!string.IsNullOrEmpty(skuInfo.BUdf10))
            {
                paramArray[80].Value = skuInfo.BUdf10;
            }
            else
            {
                paramArray[80].Value = DBNull.Value;
            }
            if (!string.IsNullOrEmpty(skuInfo.Remark1))
            {
                paramArray[0x51].Value = skuInfo.Remark1;
            }
            else
            {
                paramArray[0x51].Value = DBNull.Value;
            }
            if (!string.IsNullOrEmpty(skuInfo.Remark2))
            {
                paramArray[0x52].Value = skuInfo.Remark2;
            }
            else
            {
                paramArray[0x52].Value = DBNull.Value;
            }
            paramArray[0x53].Value = skuInfo.IsActive;
            paramArray[0x54].Value = skuInfo.CreatedBy;
            paramArray[0x55].Value = skuInfo.UpdatedBy;
            paramArray[0x56].Value = skuInfo.DaysToExpire;
            if (!string.IsNullOrEmpty(skuInfo.ItemNoID))
            {
                paramArray[0x57].Value = skuInfo.ItemNoID;
                return paramArray;
            }
            paramArray[0x57].Value = DBNull.Value;
            return paramArray;
        }

        public int UpdateIsActive(List<string> ownerID, List<string> skuID, string isActive, List<string> whLoginID, PubParasInfo pubParasInfo)
        {
            int result = 0;
            DataBase dataBase = new DataBase();
            DbConnection conn = dataBase.connection;
            conn.Open();
            DbTransaction tran = conn.BeginTransaction();
            try
            {
                for (int i = 0; i < whLoginID.Count; i++)
                {
                    for (int j = 0; j < skuID.Count; j++)
                    {
                        SqlParameter[] paras = new SqlParameter[] { new SqlParameter("@IS_ACTIVE", isActive), new SqlParameter("@UPDATED_BY", pubParasInfo.UserID), new SqlParameter("@OWNER_ID", ownerID[j]), new SqlParameter("@SKU_ID", skuID[j]) };
                        result += dataBase.ExecuteNonQuery(tran, CommandType.Text, this.SQL_UPDATE_SKU_ISACTIVE.Replace("@_@", whLoginID[i]), paras);
                    }
                }
                tran.Commit();
            }
            catch (SqlException sqlEx)
            {
                tran.Rollback();
                CommonErrorHandler.ErrorHandler(sqlEx, LogType.Error);
            }
            finally
            {
                conn.Close();
            }
            return result;
        }

        public int UpdateIsActive(DataBase dataBase, DbTransaction tran, List<string> ownerID, List<string> skuID, string isActive, List<string> whLoginID, PubParasInfo pubParasInfo)
        {
            int result = 0;
            try
            {
                for (int i = 0; i < whLoginID.Count; i++)
                {
                    for (int j = 0; j < skuID.Count; j++)
                    {
                        SqlParameter[] paras = new SqlParameter[] { new SqlParameter("@IS_ACTIVE", isActive), new SqlParameter("@UPDATED_BY", pubParasInfo.UserID), new SqlParameter("@OWNER_ID", ownerID[j]), new SqlParameter("@SKU_ID", skuID[j]) };
                        result += dataBase.ExecuteNonQuery(tran, CommandType.Text, this.SQL_UPDATE_SKU_ISACTIVE.Replace("@_@", whLoginID[i]), paras);
                    }
                }
            }
            catch (SqlException sqlEx)
            {
                CommonErrorHandler.ErrorHandler(sqlEx, LogType.Error);
            }
            return result;
        }

        public int UpdateSku(SkuInfo skuInfo, List<string> whLoginID)
        {
            int result = 0;
            DataBase db = new DataBase();
            DbConnection conn = db.connection;
            conn.Open();
            DbTransaction tran = conn.BeginTransaction();
            try
            {
                for (int i = 0; i < whLoginID.Count; i++)
                {
                    skuInfo.WhID = whLoginID[i].Substring(0, whLoginID[i].Length - 1);
                    SqlParameter[] paras = this.Set_Sku_Parameters(skuInfo);
                    if (paras != null)
                    {
                        result += db.ExecuteNonQuery(tran, CommandType.Text, this.SQL_UPDATE_SKU.Replace("@_@", whLoginID[i]), paras);
                    }
                }
                tran.Commit();
            }
            catch (SqlException sqlEx)
            {
                tran.Rollback();
                CommonErrorHandler.ErrorHandler(sqlEx, LogType.Error);
            }
            finally
            {
                conn.Close();
            }
            return result;
        }

        public int UpdateSku(DataBase dataBase, DbTransaction tran, SkuInfo skuInfo, List<string> whLoginID)
        {
            int result = 0;
            try
            {
                for (int i = 0; i < whLoginID.Count; i++)
                {
                    skuInfo.WhID = whLoginID[i].Substring(0, whLoginID[i].Length - 1);
                    SqlParameter[] paras = this.Set_Sku_Parameters(skuInfo);
                    if (paras != null)
                    {
                        result += dataBase.ExecuteNonQuery(tran, CommandType.Text, this.SQL_UPDATE_SKU.Replace("@_@", whLoginID[i]), paras);
                    }
                }
            }
            catch (SqlException sqlEx)
            {
                CommonErrorHandler.ErrorHandler(sqlEx, LogType.Error);
            }
            return result;
        }

        public int UpdateSkuWeight(string skuID, string ownerID, string weight, string whLoginID, PubParasInfo pubParasInfo)
        {
            int result = 0;
            DataBase db = new DataBase();
            DbConnection conn = db.connection;
            conn.Open();
            DbTransaction tran = conn.BeginTransaction();
            try
            {
                SqlParameter[] paras = new SqlParameter[] { new SqlParameter("@SKU_ID", skuID), new SqlParameter("@OWNER_ID", ownerID), new SqlParameter("@UPDATED_BY", pubParasInfo.UserID), new SqlParameter("@NET_WGT", weight) };
                if (paras != null)
                {
                    result += db.ExecuteNonQuery(tran, CommandType.Text, this.SQL_UPDATE_SKU_WEIGHT.Replace("@_@", whLoginID), paras);
                }
                tran.Commit();
            }
            catch (SqlException sqlEx)
            {
                tran.Rollback();
                CommonErrorHandler.ErrorHandler(sqlEx, LogType.Error);
            }
            finally
            {
                conn.Close();
            }
            return result;
        }

        public int UpdateSkuWeight(DataBase dataBase, DbTransaction tran, string skuID, string ownerID, string weight, string whLoginID, PubParasInfo pubParasInfo)
        {
            int result = 0;
            try
            {
                SqlParameter[] paras = new SqlParameter[] { new SqlParameter("@SKU_ID", skuID), new SqlParameter("@OWNER_ID", ownerID), new SqlParameter("@UPDATED_BY", pubParasInfo.UserID), new SqlParameter("@NET_WGT", weight) };
                if (paras != null)
                {
                    result += dataBase.ExecuteNonQuery(tran, CommandType.Text, this.SQL_UPDATE_SKU_WEIGHT.Replace("@_@", whLoginID), paras);
                }
            }
            catch (SqlException sqlEx)
            {
                CommonErrorHandler.ErrorHandler(sqlEx, LogType.Error);
            }
            return result;
        }

        public int UpdateSkuWeightSameStyle(string ownerID, string weight, string skuStyle, string whLoginID, PubParasInfo pubParasInfo)
        {
            int result = 0;
            DataBase db = new DataBase();
            DbConnection conn = db.connection;
            conn.Open();
            DbTransaction tran = conn.BeginTransaction();
            try
            {
                SqlParameter[] paras = new SqlParameter[] { new SqlParameter("@OWNER_ID", ownerID), new SqlParameter("@UPDATED_BY", pubParasInfo.UserID), new SqlParameter("@NET_WGT", weight), new SqlParameter("@SKU_STYLE", skuStyle) };
                if (paras != null)
                {
                    result += db.ExecuteNonQuery(tran, CommandType.Text, this.SQL_UPDATE_SKU_WEIGHT_SAME_STYLE.Replace("@_@", whLoginID), paras);
                }
                tran.Commit();
            }
            catch (SqlException sqlEx)
            {
                tran.Rollback();
                CommonErrorHandler.ErrorHandler(sqlEx, LogType.Error);
            }
            finally
            {
                conn.Close();
            }
            return result;
        }

        public int UpdateSkuWeightSameStyle(DataBase dataBase, DbTransaction tran, string ownerID, string weight, string skuStyle, string whLoginID, PubParasInfo pubParasInfo)
        {
            int result = 0;
            try
            {
                SqlParameter[] paras = new SqlParameter[] { new SqlParameter("@OWNER_ID", ownerID), new SqlParameter("@UPDATED_BY", pubParasInfo.UserID), new SqlParameter("@NET_WGT", weight), new SqlParameter("@SKU_STYLE", skuStyle) };
                if (paras != null)
                {
                    result += dataBase.ExecuteNonQuery(tran, CommandType.Text, this.SQL_UPDATE_SKU_WEIGHT_SAME_STYLE.Replace("@_@", whLoginID), paras);
                }
            }
            catch (SqlException sqlEx)
            {
                CommonErrorHandler.ErrorHandler(sqlEx, LogType.Error);
            }
            return result;
        }
    }
}

